﻿// Groupon.NET C# Library
// Copyright (c) 2011 James Paul Duncan (JPaulDuncan)
// The MIT License (MIT)
// Permission is hereby granted, free of charge, to any person obtaining a 
// copy of this software and associated documentation files (the "Software"), 
// to deal in the Software without restriction, including without limitation 
// the rights to use, copy, modify, merge, publish, distribute, sublicense, 
// and/or sell copies of the Software, and to permit persons to whom the 
// Software is furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included 
// in all copies or substantial portions of the Software.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
// DEALINGS IN THE SOFTWARE. 
// http://www.jpaulduncan.com

namespace Groupon.Net
{
    public sealed class TextAd : ModelBase
    {
        private string _line1;
        private string _line2;
        private string _headline;

        public TextAd() : base() { }

        public string Headline
        {
            get { return _headline; }
            set { base.SetProperty<string>("Headline", ref _headline, value); }
        }

        public string Line1
        {
            get { return _line1; }
            set { base.SetProperty<string>("Line1", ref _line1, value); }
        }

        public string Line2
        {
            get { return _line2; }
            set { SetProperty<string>("Line2", ref _line2, value); }
        }

        internal static TextAd Parse(System.Xml.XmlNode xmlNode)
        {
            TextAd result = new TextAd();

            if (xmlNode != null)
            {
                result.Headline = xmlNode.SelectSingleNode("headline").GetText();
                result.Line1 = xmlNode.SelectSingleNode("line1").GetText();
                result.Line2 = xmlNode.SelectSingleNode("line2").GetText();
            }

            return result;
        }

    }
}